{% extends 'base.html' %}
{% load static %}
{% block head %}
<link rel="stylesheet" href="{% static 'css/projects/trash.css' %}?v=1">
<title>Корзина</title>
{% endblock %}

{% block content %}
<div class="backbtn">
    <a href="{% url 'projects' %}?id={{project_id}}">← Назад</a>
</div>
<div class="content">
    {% if len == 0 %}
    <p> Здесь будут появляться удалённые файлы </p>
    {% else %}
    <ul class="file-list">
        {% for file, name in files %}
        <li class="file-item">
            <a href="{% url 'download_file' %}?file_id={{file.id}}"
                title="Загрузить файл">{{file.name}}</a>
            <div class="btns">
                <form method="post" action="{% url 'restore_file' %}">
                    {% csrf_token %}
                    <input type="hidden" name="file_id" value="{{file.id}}">
                    <button title="Восстановить файл" type="submit" id="restore_file{{file.id}}">
                        <svg fill="none" height="20" viewBox="0 0 384 512" width="20"
                            xmlns="http://www.w3.org/2000/svg">
                            <path
                                d="M256 0v128h128L256 0zM224 128L224 0H48C21.49 0 0 21.49 0 48v416C0 490.5 21.49 512 48 512h288c26.51 0 48-21.49 48-48V160h-127.1C238.3 160 224 145.7 224 128zM288.1 344.1C284.3 349.7 278.2 352 272 352s-12.28-2.344-16.97-7.031L216 305.9V408c0 13.25-10.75 24-24 24s-24-10.75-24-24V305.9l-39.03 39.03c-9.375 9.375-24.56 9.375-33.94 0s-9.375-24.56 0-33.94l80-80c9.375-9.375 24.56-9.375 33.94 0l80 80C298.3 320.4 298.3 335.6 288.1 344.1z"
                                fill="#88cc5a" />
                        </svg>
                    </button>
                </form>            
                <button title="Удалить файл" type="button">
                    <svg fill="none" height="20" viewBox="0 0 20 20" width="20"
                        xmlns="http://www.w3.org/2000/svg">
                        <path
                            d="M3.89705 4.05379L3.96967 3.96967C4.23594 3.7034 4.6526 3.6792 4.94621 3.89705L5.03033 3.96967L10 8.939L14.9697 3.96967C15.2359 3.7034 15.6526 3.6792 15.9462 3.89705L16.0303 3.96967C16.2966 4.23594 16.3208 4.6526 16.1029 4.94621L16.0303 5.03033L11.061 10L16.0303 14.9697C16.2966 15.2359 16.3208 15.6526 16.1029 15.9462L16.0303 16.0303C15.7641 16.2966 15.3474 16.3208 15.0538 16.1029L14.9697 16.0303L10 11.061L5.03033 16.0303C4.76406 16.2966 4.3474 16.3208 4.05379 16.1029L3.96967 16.0303C3.7034 15.7641 3.6792 15.3474 3.89705 15.0538L3.96967 14.9697L8.939 10L3.96967 5.03033C3.7034 4.76406 3.6792 4.3474 3.89705 4.05379L3.96967 3.96967L3.89705 4.05379Z"
                            fill="#e24a4a" />
                        </svg>
                </button>
            </div>
            </li>
        {% endfor %}
    </ul>
    {% endif %}
</div>
{% endblock %}
